Fix event race
authorDaniel Colascione <dancol@dancol.org>
Mon, 24 Feb 2014 14:26:49 +0000 (06:26 -0800)
committerDaniel Colascione <dancol@dancol.org>
Mon, 24 Feb 2014 14:26:49 +0000 (06:26 -0800)
src/ChangeLog
src/keyboard.c

index 82bdd127d264337ebf795be202f7153277399800..e481a052abc29eed4416ec7d626fabe3d73a6211 100644 (file)
@@ -1,3 +1,7 @@
+2014-02-24  Daniel Colascione  <dancol@dancol.org>
+
+       * keyboard.c (read_char): Close race that resulted in lost events.
+
 2014-02-21  Daniel Colascione  <dancol@dancol.org>
 
        * dbusbind.c: Rename dbus-init-bus to dbus-init-bus-1.
index 9dcb58ae66cd09e0b2f9a134d3341995d8205676..038ce6ea601c39b7f631d44b33fd9bab75fb0c17 100644 (file)
@@ -2891,8 +2891,12 @@ read_char (int commandflag, Lisp_Object map,
     {
       c = read_decoded_event_from_main_queue (end_time, local_getcjmp,
                                               prev_event, used_mouse_menu);
-      if (end_time && timespec_cmp (*end_time, current_timespec ()) <= 0)
-        goto exit;
+      if (NILP(c) && end_time &&
+          timespec_cmp (*end_time, current_timespec ()) <= 0)
+        {
+          goto exit;
+        }
+
       if (EQ (c, make_number (-2)))
         {
          /* This is going to exit from read_char